package com.hspjava.date_;


import java.util.Calendar;

public class Calendar01 {
    public static void main(String[] args){
        //1.Calendar是抽象类， 构造器私有化，
        //2.可以通过getInstance()来获取实例
        //3.提供大量字段提供给程序员

        Calendar c = Calendar.getInstance();
        System.out.println(c.get(Calendar.YEAR));
        System.out.println(c.get(Calendar.MONTH) + 1);//加1是因为默认从0计算
        System.out.println(c.get(Calendar.DATE));
        System.out.println(c.get(Calendar.HOUR));
        System.out.println(c.get(Calendar.MINUTE));

        //没有专门格式化方法，自己指定
        System.out.println("年："+ c.get(Calendar.YEAR)+ " 月:" + (c.get(Calendar.MONTH) + 1) + " 日" + c.get(Calendar.DATE));

    }
}
